package org.dbstar.scheduler.control.db.catalog;

import java.sql.Types;

import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.SqlParameter;
import org.springframework.jdbc.object.SqlUpdate;

/**
 * CataLog的Update对象，只更新parent字段
 * 
 * @author 代波
 * @since 1.0.0
 * @version 1.0.0
 * @date 2012-4-21
 */
public class CatalogMove extends SqlUpdate {
	public CatalogMove(JdbcTemplate jdbcTemplate) {
		super();
		setJdbcTemplate(jdbcTemplate);
		setSql("UPDATE SCHD_CATALOG SET PARENT=? WHERE ID=?");
		declareParameter(new SqlParameter("PARENT", Types.INTEGER));
		declareParameter(new SqlParameter("ID", Types.INTEGER));
	}

	public int moveCatalog(int catalogId, int parent) {
		return update(parent, catalogId);
	}
}
